<template>
  <div id="app">
    <Navbar class="app__navbar"></Navbar>

    <main>
      <!-- 左侧导航 -->
      <div class="main-left">
        <el-menu default-active="page1"  class="el-menu-vertical-demo" :router="true">
          <template v-for="(item) in $router.options.routes">
            <el-menu-item v-for="child in item.children" :index="child.path" :key="child.path">{{child.name}}</el-menu-item>
          </template>

        </el-menu>
      </div>

      <!-- 右侧主内容区 -->
      <section class="content-container main-right">
        <router-view></router-view>
      </section>
    </main>
  </div>
</template>

<script>

  import Navbar from '@/components/navbar/navbar'

  export default {
    components: {
      Navbar,
    },
    data() {
      return {
        msg: 'Welcome to Your Vue.js App'
      }
    },
    created:function () {
      this.$router.push('/page1');
    }

  }
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style>
  /*body{margin: 0;}*/

  #app {
    min-width: 1200px;

    font-family: "Helvetica Neue","PingFang SC",Arial,sans-serif;
  }

  .app__navbar {
    position: fixed;
    top: 0;
    z-index: 1;
    width: 100%;
  }

  header {
    z-index: 1000;
    min-width: 1200px;
    transition: all 0.5s ease;
    border-top: solid 4px #3091F2;
    background-color: #fff;
    box-shadow: 0 2px 4px 0 rgba(0, 0, 0, .12), 0 0 6px 0 rgba(0, 0, 0, .04);
  }

  header.header-fixed {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
  }

  header .el-menu-demo {
    padding-left: 300px !important;
  }

  main {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    min-height: 800px;
    border: solid 40px #E9ECF1;
    background-color: #FCFCFC;
    margin-top: 60px
  ;
  }

  main .main-left {
    text-align: center;
    width: 200px;
    float: left;
  }

  main .main-right {
    background-color: #fff;
    padding: 50px 70px;
  }

  main .el-menu {
    background-color: transparent !important;
  }

</style>
